package com.example.springboothomework.entity.dto;

import com.example.springboothomework.validator.ValidGroup;
import lombok.Getter;
import lombok.Setter;

import javax.validation.constraints.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;

/**
 * @author: chenjianhao
 * @date: 2025/6/5
 *
 * 公司DTO
 */
@Getter
@Setter
public class CompanyDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @Null(groups = ValidGroup.Save.class,message = "新增公司时ID必须为空")
    @NotNull(groups = ValidGroup.Update.class,message = "公司ID不能为空")
    private Long id;
    
    @NotBlank(message = "公司名称不能为空")
    @Size(min = 2, max = 100, message = "公司名称长度需在2-100字符之间")
    private String name;
    
    @NotNull(message = "成立日期不能为空")
    @PastOrPresent(message = "成立日期不能是未来时间")
    private LocalDate establishmentDate;
    
    @NotNull(message = "注册资本不能为空")
    @DecimalMin(value = "0.00", inclusive = false, message = "注册资本需大于0")
    @Digits(integer = 18, fraction = 2, message = "注册资本格式不合法")
    private BigDecimal registeredCapital;
    
    @NotNull(message = "运营状态不能为空")
    private Boolean operating;
}